package com.formation.userbase.persistance.services;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.formation.userbase.persistance.beans.Product;
import com.formation.userbase.persistance.dao.ProductDao;
import com.formation.userbase.persistance.dao.ProductHibernateDao;

@Service(value="productservicebean")
public class ProductImplementService implements ProductService {
	@Resource(name="productdaobean")
	ProductDao monDao;
	
	
	
	public ProductDao getMonDao() {
		return monDao;
	}

	public void setMonDao(ProductDao monDao) {
		this.monDao = monDao;
	}

	public ProductImplementService(){
		monDao=new ProductHibernateDao();
	}
	
	@Override
	public Product findProductByRef(String ref) {
		// TODO Auto-generated method stub
		return monDao.findProductByRef(ref);
	}

	@Override
	public List<Product> getAllProduct() {
		// TODO Auto-generated method stub
		return monDao.getAllProduct();
	}

	@Override
	public boolean insert(Product p) {
		// TODO Auto-generated method stub
		if(monDao.insert(p))
			return true;
		else
			return false;
	}

}
